import {createRouter, createWebHashHistory} from 'vue-router'

//路由数组
const routes = [
    {
        path: '/',
        redirect: {name: 'admin'},
    },
    {
        path: '/admin',
        name: 'admin',
        // redirect: {name: 'admin/wel1'},
        meta: {isLogin: true,},
        // redirect: { name: 'admin_vedio' },
        component: () => import('../views/layout/layout.vue'),
        children: [
            {
                des: '系统设置',
                name: 'admin_system',
                path: '/admin/system',
                component: () => import('../views/system/config.vue'),
                // redirect: 'system/sysuser',
            },
            // {
            //     des: '系统设置',
            //     path: '/admin/system',
            //     component: () => import('../views/system/index.vue'),
            //     // redirect: 'system/sysuser',
            //     children: [
            //         {
            //             des: '系统用户',
            //             path: '/admin/system/sysuser',
            //             component: () => import('../views/system/sysuser/index.vue')
            //         }, {
            //             des: '系统菜单',
            //             path: '/admin/system/sysmenu',
            //             component: () => import('../views/system/sysmenu/index.vue')
            //         }, {
            //             des: '系统角色',
            //             path: '/admin/system/sysrole',
            //             component: () => import('../views/system/sysrole/index.vue')
            //         }]
            // }
        ]
    },
    {
        des: '登陆',
        path: '/login',
        component: () => import('../views/public/login.vue')
    },
    {
        des: '注册',
        path: '/register',
        component: () => import('../views/public/login.vue')
    }
]
//路由对象
const router = createRouter({
    // history: createWebHistory(process.env.BASE_URL),
    history:createWebHashHistory(),
    routes //上面的路由数组
})
router.beforeEach((to, from, next) => {
    // ViewUIPlus.LoadingBar.start();
    next();
});

router.afterEach(route => {
    // ViewUIPlus.LoadingBar.finish();
});
//导出路由对象，在main.js中引用
export default router
